{% extends 'base.html' %}

{% block title %}登录 - 外卖管理系统{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">用户登录</h4>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        <div class="form-group">
                            <label for="{{ form.username.id_for_label }}">用户名</label>
                            {{ form.username }}
                            {% if form.username.errors %}
                                <div class="invalid-feedback">
                                    {% for error in form.username.errors %}
                                        <p>{{ error }}</p>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        </div>

                        <div class="form-group">
                            <label for="{{ form.password.id_for_label }}">密码</label>
                            {{ form.password }}
                            {% if form.password.errors %}
                                <div class="invalid-feedback">
                                    {% for error in form.password.errors %}
                                        <p>{{ error }}</p>
                                    {% endfor %}
                                </div>
                            {% endif %}
                        </div>

                        <button type="submit" class="btn btn-primary">登录</button>
                        <p>还没有账号？<a href="{% url 'register' %}">立即注册</a></p>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
